package com.zmzncs.lmtc.module.finance.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zmzncs.lmtc.common.pojo.PageInfo;
import com.zmzncs.lmtc.common.pojo.Rest;
import com.zmzncs.lmtc.common.util.JsonUtil;
import com.zmzncs.lmtc.common.util.RestUtil;
import com.zmzncs.lmtc.module.customer.pojo.cust_info.CustInfoDTO;
import com.zmzncs.lmtc.module.customer.pojo.cust_info.CustInfoGrantTicketVO;
import com.zmzncs.lmtc.module.finance.pojo.TransactionRecordDTO;
import com.zmzncs.lmtc.module.finance.pojo.TransactionRecordForm;
import com.zmzncs.lmtc.module.finance.pojo.TransactionRecordVO;
import com.zmzncs.lmtc.module.finance.pojo.TransactionSummaryRecordDTO;
import com.zmzncs.lmtc.module.finance.service.TransactionRecordService;
import com.zmzncs.lmtc.module.park.pojo.bolian_pull.BolianPull;
import com.zmzncs.lmtc.module.park.pojo.park_info.ParkInfoDTO;
import com.zmzncs.lmtc.module.park.pojo.park_info.ParkInfoListForm;
import com.zmzncs.lmtc.module.park.pojo.park_info.ParkTableVO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 交易记录表 前端控制器
 * </p>
 *
 * @author JD
 * @since 2020-09-07
 */
@RestController
@RequestMapping("/finance/transactionRecord")
public class TransactionRecordController {

    @Autowired
    TransactionRecordService transactionRecordService;

    @ApiOperation(value = "获取交易记录分页列表")
   @ApiImplicitParams({
           @ApiImplicitParam(paramType = "header", name = "token", value = "请求头token", required = true),
   })
    @PostMapping(value = "/getPage")
    public Rest<Map<String,Object>> getPage(@RequestBody TransactionRecordForm form){
        IPage<TransactionRecordDTO> transactionRecordDTOIPage = transactionRecordService.getTransactionRecordPage(form);
        PageInfo<TransactionRecordVO> transactionRecordVOPageInfo = JsonUtil.pageTransform(transactionRecordDTOIPage, TransactionRecordVO.class);
        return RestUtil.success(transactionRecordVOPageInfo);
    }



    @ApiOperation(value = "查询财务-总交易汇总金额")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "请求头token", required = true),
    })
    @GetMapping(value = "getTransactionSummary")
    public Rest<TransactionSummaryRecordDTO> getTransactionSummary() {
        TransactionSummaryRecordDTO transactionSummaryRecordDTO = transactionRecordService.selectTransactionSummary();
        return RestUtil.success(transactionSummaryRecordDTO);
    }

}

